package utilities;

import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public class BibliotecaJDBC {

	public static Connection getConnection() {
		Connection c = null;
		try {
			Properties props = new Properties();
			FileInputStream in = new FileInputStream("database3.properties");
			props.load(in);
			in.close();

			String drivers = props.getProperty("jdbc.drivers");
			if (drivers != null)
				System.setProperty("jdbc.drivers", drivers);

			String url = props.getProperty("jdbc.url");
			String username = props.getProperty("jdbc.username");
			String password = props.getProperty("jdbc.password");
			c = DriverManager.getConnection(url, username, password);
		} catch (Exception e) {
		}

		return c;
	}
}
